'''
Created on 2012-1-5
The example client program uses some sockets to demonstrate how the server
with select() manages multiple connections at the same time . The client
starts by connecting each TCP/IP socket to the server
@author: peter
'''
 
import socket
 
messages = ["This is the message" ,
            "It will be sent" ,
            "in parts "]
 
print "Connect to the server"
 
server_address = ("192.168.9.87",50000)
 
#Create a TCP/IP sock
 
socks = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
 
socks.connect(server_address)
 
counter = 0
while 1:
    #Sending message from different sockets
    print "  %s sending %s" % (socks.getpeername(),messages[0]+" version "+str(counter))
    socks.send(messages[0]+" version "+str(counter))
    #Read responses on both sockets
    #data = socks.recv(1024)
    #print " %s received %s" % (socks.getpeername(),data)
    #if not data:
    #    print "closing socket ",socks.getpeername()
socks.close()
